package ooday01;

public class Student {
    String name;
    private int age;
    String stuId;
    String className;

    void setAge(int age) {
        if (age >= 18 && age <= 50) {
            this.age = age;
        } else {
            System.out.println("非法数字");
        }
    }

    int getAge() {
        return age;

    }

    Student(String name, int age, String stuId, String className) {
        this.name = name;
        this.age = age;
        this.stuId = stuId;
        this.className = className;

    }

    Student() {
    }

    void play() {
        System.out.println(this.name + "在玩游戏");
    }

    void saHi() {
        System.out.println("大家好,我叫" + this.name + ", 今年" + this.age + "岁了,所在班级为" + this.className + ", 学号为:" + this.stuId);
    }

    void playWith(String anotherName) {
        System.out.println(this.name + "正在和" + anotherName + "一起玩....");
    }
}
